package com.yzy.fly.mapper;

import com.yzy.fly.entity.core.FlyClassCascade;
import com.yzy.fly.kernel.mapper.FlyBasicMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface FlyClassCascadeMapper extends FlyBasicMapper<FlyClassCascade> {

    @Select("select * from fly_class_cascade a where 1=1")
    List<FlyClassCascade> selectAll();

    @Select("select * from fly_class_cascade a where 1=1 and a.systemId = #{systemId}")
    List<FlyClassCascade> selectAllBySystemId(@Param("systemId") int systemId);

    @Select("select * from fly_class_cascade a where 1=1 and a.id = (select b.classId from fly_field b where b.id = #{fieldId})")
    FlyClassCascade selectOneByFieldId(@Param("fieldId") int fieldId);

    @Select("select * from fly_class_cascade a where 1=1 and a.name = #{name}")
    FlyClassCascade selectOneByName(@Param("name") String name);

    @Select("select * from fly_class_cascade a where 1=1 and a.modelId = #{modelId}")
    int deleteByModelId(@Param("modelId") Integer modelId);


}